/* 
 * File:   Lock.h
 * Author: Vicky.H
 * Email:  eclipser@163.com
 *
 * Created on 2014年1月17日, 下午4:45
 */

#ifndef CN_VICKY__LOCK_H
#define	CN_VICKY__LOCK_H
#include "pthread.h"

class MyLock {
    pthread_mutex_t m_Mutex;
public:

    MyLock() {
        pthread_mutex_init(&m_Mutex, NULL);
    };

    ~MyLock() {
        pthread_mutex_destroy(&m_Mutex);
    };

    void Lock() {
        pthread_mutex_lock(&m_Mutex);
    };

    void Unlock() {
        pthread_mutex_unlock(&m_Mutex);
    };
};

#endif	/* CN_VICKY__LOCK_H */

